/*
package com.argticling.service;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.omg.CORBA.NameValuePair;
import org.springframework.http.HttpMethod;
import sun.net.www.http.HttpClient;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.http.AccessToken;

public class TwitterService extends HttpServlet {

	String responseTxt;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		getResponse(request.getParameter("url"));
		PrintWriter writer = response.getWriter();
		String[] array = responseTxt.split(",");
		String result;
		result = array[4].replace(" \"shortUrl\": \"", "");
		result = result.replace("\"", "");

		Status status = null;
		// Registar la aplicaion, y conseguir las Token se explica en la
		// siguienete pagina
		// http://consultingblogs.emc.com/nileeshabojjawar/archive/2010/03/18/twitter4j-oauth-generating-the-access-token.aspx
		Twitter twitter = new TwitterFactory().getInstance();
		twitter.setOAuthConsumer(consumerKey, consumerSecret);
		AccessToken accessToken = new AccessToken(twitterToken,	twitterTokenSecret);
		twitter.setOAuthAccessToken(accessToken);
		try {
			twitter.verifyCredentials();
		} catch (TwitterException e) {
			writer.println("Login Error");
			return;
		}
		try {
			status = twitter.updateStatus("Usted desea entrar a " + result);
		} catch (TwitterException e) {

		}
		writer.println(responseTxt);
	}

	private void getResponse(String url) {
		HttpClient httpclient = new HttpClient();
		HttpMethod method = new GetMethod("http://api.bit.ly/shorten");
		method.setQueryString(new NameValuePair[] {
				new NameValuePair("longUrl", url),
				new NameValuePair("version", "2.0.1"),
				new NameValuePair("login", "dalkia"),
				new NameValuePair("apiKey",	"R_8a8131de14e7c7334115a029fb6e3bdd"),
				new NameValuePair("format", "json"), });
		try {
			httpclient.executeMethod(method);
			responseTxt = method.getResponseBodyAsString();
		} catch (HttpException e1) {
			e1.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

}
*/
